<?php
function Post($data, $target) {
    $url_info = parse_url($target);
    $httpheader = "POST " . $url_info['path'] . " HTTP/1.0\r\n";
    $httpheader .= "Host:" . $url_info['host'] . "\r\n";
    $httpheader .= "Content-Type:application/x-www-form-urlencoded\r\n";
    $httpheader .= "Content-Length:" . strlen($data) . "\r\n";
    $httpheader .= "Connection:close\r\n\r\n";
    //$httpheader .= "Connection:Keep-Alive\r\n\r\n";
    $httpheader .= $data;

   $fd = fsockopen($url_info['host'], 6003);
    fwrite($fd, $httpheader);
    $gets = "";
    while(!feof($fd)) {
        $gets .= fread($fd, 128);
    }
    fclose($fd);
    // return $gets;
   return true;
}

function sms($receivers, $content)
{
	  $target = "http://dx.lmobile.cn:6003/submitdata/Service.asmx/g_Submit";
	//替换成自己的测试账号,参数顺序和wenservice对应
	foreach ($receivers as $receiver)
	{
		$post_data = "sname=kdlnbhsft&spwd=5sf5sf&scorpid=&sprdid=1012802&sdst=".$receiver."&smsg=".rawurlencode($content);
		//$binarydata = pack("A", $post_data);
		$gets = Post($post_data, $target);
	}
	return $gets;
}
//echo sms(array(15888527509), '是非得我草死你失'.time());
?>